import "@babel/polyfill";
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import Antd from "ant-design-vue";
import "ant-design-vue/dist/antd.less";
// import "./assets/main.css";
import "../mock"; //引用mock
// import echarts from "echarts";

import VueI18n from "vue-i18n";
// import GLOBAL from "@/utils/login";
// import language from "./lang";
// import GlobalDirective from "./extend/directive";
import { language, GlobalDirective, Login } from "libs-common-utils";
import common from '../src/utils/common'
import LibsCommonBasics from "libs-common-basics";
import "libs-common-basics/lib/libs-common-basics.css";
import "libs-common-views/lib/libs-common-views.css";

Vue.use(LibsCommonBasics);
Vue.prototype.$common = common;

Vue.prototype.GLOBAL = Login;

// Vue.prototype.$echarts = echarts;

Vue.config.productionTip = false;

// 全局自定义指令注册
Vue.use(GlobalDirective);

// 全局安装Vue语言插件
Vue.use(VueI18n);

// 全局安装Antd UI插件
Vue.use(Antd);

// 全局安装百度地图插件
// Vue.use(BaiduMap, {
//     ak: "gLOrC2pnDQP9ltXrEwV8NA761xlVPGr0",
// });
// 全局安装web播放插件
// Vue.use(VideoPlayer);

// Vue语言切换
const i18n = new VueI18n({
    locale: localStorage.getItem("locale") || "zh-cn", // 语言表示，通过切换local来切换本地语言
    messages: language,
});

// 全局路由前置守卫
router.beforeEach((to, from, next) => {
    /* 流程图页面状态保持路由处理 */
    to.meta.keepAlive = false;
    // if (to.path.indexOf("/main/artwork") > -1) {
    //     if (store.state.Draw.remainData.length > 0) {
    //         store.state.Draw.remainData.forEach(item => {
    //             if (item.chartId == to.params.id) {
    //                 if (!to.meta.keepAlive) {
    //                     to.meta.keepAlive = true;
    //                 }
    //             }
    //         });
    //     }
    // }
    next();
});

new Vue({
    i18n,
    router,
    store,
    render: h => h(App),
}).$mount("#app");
